package com.har.modules.web.service.impl;

import com.google.code.kaptcha.Producer;
import com.har.modules.web.service.SysCaptchaService;
import org.springframework.beans.factory.annotation.Autowired;

import java.awt.image.BufferedImage;

/**
 * @author maoruidd
 * @desc: 验证码
 * @create 2018-09-14 下午 5:03
 */

public class SysCaptchaServiceImpl implements SysCaptchaService {

    @Autowired
    private Producer producer;

    @Override
    public BufferedImage getCaptcha() {
        String code = producer.createText();

        //获取图片验证码
        return producer.createImage(code);
    }
}
